package org.example.demo.util;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;


/**
 * 	返回的结果对象
 * @author gaoming.yang
 */
@SuppressWarnings("all")
public class ReturnMap implements Serializable{
	
	private static final long serialVersionUID = 1L;
	private int returnCode;
	private String returnMsg;
	private Map dataMap;
	private static String KEY_DATA = "data";
	private static String KEY_CODE = "returnCode";
	private static String KEY_MSG = "returnMsg";
	
	public ReturnMap()
	{
		returnCode = 200;
		returnMsg = "SUCCESS";
		dataMap = new HashMap();
		dataMap.put(KEY_CODE, this.returnCode);
		dataMap.put(KEY_MSG, this.returnMsg);
	}
	
	public int getReturnCode() {
		return returnCode;
	}

	public void setReturnCode(int returnCode) {
		this.returnCode = returnCode;
		dataMap.remove(KEY_CODE);
		dataMap.put(KEY_CODE, this.returnCode);
	}
	
	public String getReturnMsg() {
		return returnMsg;
	}
	
	public void setReturnMsg(String returnMsg) {
		this.returnMsg = returnMsg;
		dataMap.remove(KEY_MSG);
		dataMap.put(KEY_MSG, this.returnMsg);
	}
	public void setData(Object obj)
	{
		dataMap.put(KEY_DATA, obj);
	}
	public void setData(String key,Object obj)
	{
		dataMap.put(key, obj);
	}
	public Map getreturnMap()
	{
		return this.dataMap;
	}

	@Override
	public String toString() {
		return "ReturnMap [returnCode=" + returnCode + ", returnMsg=" + returnMsg + ", dataMap=" + dataMap.toString() + "]";
	}

	

}
